package com.heima.mapper;
import com.github.pagehelper.Page;
import com.heima.pojo.dto.PageQueryDTO;
import com.heima.pojo.dto.RegionDTO;
import com.heima.pojo.entity.Region;
import com.heima.pojo.vo.RegionVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface RegionMapper {

    @Insert("insert into tb_region(name, remark) values (#{regionName},#{remark})")
    Integer add(RegionDTO dto);

    Page<RegionVO> pageQuery(PageQueryDTO dto);

    @Delete("delete from tb_region where id = #{id}")
    Integer deleteById(Long id);

    Integer update(Region region);
    @Select("select * from tb_region where name=#{name}")
    String selectName(String regionName);
    @Select("select * from tb_region where id=#{id}")
    RegionVO nodeRegion(Long id);
}
